<?php
/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| Here is where you can register web routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| contains the "web" middleware group. Now create something great!
|
*/
//前台路由组
Route::group(['namespace'=>'Home', 'prefix' => 'home'],function (){
    Route::get('/', function () {return view('welcome');});
    Route::get('user', 'IndexController@index');
});
//后台路由组
Route::group(['namespace' => 'Admin', 'prefix' => 'admin'], function(){

    // Index首页
    Route::get('/', 'IndexController@index')->middleware('autologin');

    // 菜单页面
    Route::prefix('menu')->group(function () {
        Route::get('getInfo', 'IndexController@getInfo');
        Route::get('add', 'IndexController@add');
        Route::get('edit', 'IndexController@edit');
        Route::any('save', 'IndexController@save');
        Route::get('del', 'IndexController@del');
    });

    // 文章页面
    Route::prefix('article')->group(function () {
        Route::get('/', 'ArticleController@index')->middleware('autologin');
        Route::any('getArticleInfo', 'ArticleController@getInfo');
        Route::any('recycle', 'ArticleController@recycle'); //文章回收站
        Route::any('recycleList', 'ArticleController@recycleList'); //文章回收站列表
        Route::any('comment', 'ArticleController@comment'); //文章评论列表
        Route::any('commentList', 'ArticleController@commentList'); //文章评论列表
        Route::any('add', 'ArticleController@add');
        Route::any('edit', 'ArticleController@edit');
        Route::any('save', 'ArticleController@save');
        Route::any('del', 'ArticleController@del');
    });

    // 文章分类页面
    Route::prefix('articlecategory')->group(function () {
        Route::get('/', 'ArticleCategoryController@index')->middleware('autologin');
        Route::any('getArticleCategoryInfo', 'ArticleCategoryController@getInfo');
        Route::any('add', 'ArticleCategoryController@add');
        Route::any('edit', 'ArticleCategoryController@edit');
        Route::any('save', 'ArticleCategoryController@save');
        Route::any('del', 'ArticleCategoryController@del');
    });

    // 用户
    Route::prefix('user')->group(function () {
        Route::get('/', 'UserController@index')->middleware('autologin');
        Route::get('getInfo', 'UserController@getInfo');
        Route::get('add', 'UserController@add');
        Route::get('edit', 'UserController@edit');
        Route::any('save', 'UserController@save');
        Route::get('del', 'UserController@del');

    });
    //后台用户
    Route::prefix('adminuser')->group(function () {
        Route::get('/', 'AdminUserController@index')->middleware('autologin');
        Route::get('getInfo', 'AdminUserController@getInfo');
        Route::get('add', 'AdminUserController@add');
        Route::get('edit', 'AdminUserController@edit');
        Route::any('save', 'AdminUserController@save');
        Route::get('del', 'AdminUserController@del');

    });
    // 评论
    Route::prefix('comment')->group(function () {
        Route::get('getInfo', 'CommentController@getInfo');
        Route::get('index', 'CommentController@index');
        Route::get('del', 'CommentController@del');
    });

    // 设置
    Route::prefix('setting')->group(function () {
        Route::get('/', 'SettingController@index')->middleware('autologin');
    });

    // 后台登录
    Route::prefix('login')->group(function () {
        Route::get('/', 'LoginController@index');
        Route::get('form', 'LoginController@form');
        Route::any('register', 'LoginController@register');
        Route::any('signIn', 'LoginController@signIn');
        Route::post('signOut','loginController@signOut');
    });

    // 打卡签到
    Route::prefix('clockin')->group(function () {
        Route::get('index', 'ClockinController@index');
        Route::get('getInfo', 'ClockinController@getInfo');
    });
    /*
     * 备注：
     *     1.注意路由提交方式 get --> Route::get GET提交｜ post --> Route::post GET提交 ｜ any --> Route::any  GET和POST都可以
     *     2.->middleware('autologin') 验证是否登陆：只需在index路由后面添加   ->middleware('autologin')    即可
     * */
});

